package com.tickdroid;

import android.app.Activity;
import android.app.Dialog;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;

public class TickDroid extends Activity {
    /** Called when the activity is first created. */
	Button btnMakeNewList;
	
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        btnMakeNewList = (Button) findViewById(R.id.btnMakeNewList);
    
        btnMakeNewList.setOnClickListener(new OnClickListener() {
 		   
		    public void onClick(View v) {
		        //txtTest.setText("TEST");
		    	Intent i = new Intent(TickDroid.this, Edit.class);
		    	i.putExtra("com.tickdroid.listname", "IT WORKS");
		         startActivity(i);
		         
		    }
        });
    
    
 
        
    }
    
    
    
    
    
    
    
    
	public boolean onCreateOptionsMenu(Menu menu) {
	    MenuInflater inflater = getMenuInflater();
	    inflater.inflate(R.menu.mainmenu, menu);
	    return true;
	}
	
	
	@Override
	public boolean onOptionsItemSelected(MenuItem item) {
	    // Handle item selection
	    switch (item.getItemId()) {
	    case R.id.mmenuAbout:
	        showAbout();
	        return true;
	    case R.id.mmenuExit:
	        finish();
	        return true;
	    default:
	        return super.onOptionsItemSelected(item);
	    }
	}
	
	public void showAbout(){
		
		
		
		
		final Dialog dialog = new Dialog(TickDroid.this);
		
		                dialog.setContentView(R.layout.about);
		
		                dialog.setTitle("This is my custom dialog box");
		
		                dialog.setCancelable(true);
		
		                //there are a lot of settings, for dialog, check them all out!
		
		 
		
		                //set up text
		
		                TextView text = (TextView) dialog.findViewById(R.id.TextView01);
		
		                text.setText("bla bla bla bla bla bla bla bla bla bla bla");
		
		 
		
		                //set up image view
		
		              //  ImageView img = (ImageView) dialog.findViewById(R.id.ImageView01);
		
		              //  img.setImageResource(R.drawable.nista_logo);
		
		 
		
		                //set up button
		
		                Button button = (Button) dialog.findViewById(R.id.Button01);
		
		                button.setOnClickListener(new OnClickListener() {
		

						@Override
						public void onClick(View v) {
							// TODO Auto-generated method stub
							  //finish();
							dialog.dismiss();
						}
		
		                });
		
		                //now that the dialog is set up, it's time to show it    
		
		                dialog.show();

		
	}
	
}